/**
 * A program that simulate the car dealership.
 *
 * <p>Purdue University -- CS18000 -- Summer 2020 -- PJ02</p>
 *
 * @author Wenru He
 * @version July 8, 2020
 */

public class Car {
    private String make;
    private String model;
    private int year;

    public Car(String make, String model, int year) {
        this.make = make;
        this.model = model;
        this.year = year;
    }

    @Override
    public String toString() {
        return "Make: " + make + " | Model: " + model + " | Year: " + year;
    }

    public String getMake() {
        return make;
    }

    public int getYear() {
        return year;
    }

    public String getModel() {
        return model;
    }

    public String lineInputLike() {
        return "[" + make + "," + model + "," + year + "]";
    }

    public void setMake(String make) {
        this.make = make;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public void setYear(int year) {
        this.year = year;
    }


    public int[] merge(int[] a1, int[] a2) {
        int[] sum = new int[a1.length + a2.length];
        int index = 0, i = 0, j = 0;
        while (i < a1.length && j < a2.length) {
            if (a1[i] < a2[j]) {
                sum[index++] = a1[i++];
            } else {
                sum[index++] = a2[j++];
            }
        }

        while (i < a1.length) {
            sum[index++] = a1[i++];
        }

        while (j < a2.length) {
            sum[index++] = a2[j++];
        }

        return sum;
    }
}
